<?php
/**
 * Here the class \UF\MissingExtensionException is defined.
 *
 * @category   UniKap-Framework
 * @package    Core
 * @subpackage Exceptions
 * @author     Ulf -UniKado- Kadner <ulfikado@gmail.com>
 * @since      2014-03-29 16:17
 * @version    0.1
 */

namespace UF
{

    /**
     * This exception is used, if a required php extension is missed.
     *
     * @since  v0.1
     */
    class MissingExtensionException extends \UF\Exception
    {

        # <editor-fold defaultstate="collapsed" desc="- - - -   P R I V A T E   F I E L D S   - - - - - - - - - - - - - - - - - - - - -">

        /**
         * @since  v0.1
         */
        private $extensionName;

        # </editor-fold>

        # <editor-fold defaultstate="collapsed" desc="- - - >   C O N S T R U C T O R   - - - - - - - - - - - - - - - - - - - - - - - -">

        /**
         * Inits a new instance.
         *
         * @param string $extensionName The PHP extension name.
         * @param string $message THe optional error message
         * @param int    $code Optional Error code (Defaults to \E_ERROR)
         * @since  v0.1
         */
        public function __construct( $extensionName, $message = null, $code = \E_ERROR )
        {
            parent::__construct(
                \UF\_1( '_core', 'PHP extension "%s" is not loaded with current PHP config.',
                    $extensionName ) . ( empty( $message ) ? '' : " {$message}" ),
                $code );
            $this->extensionName = $extensionName;
        }

        # </editor-fold>

        # <editor-fold defaultstate="collapsed" desc="- - - -   P U B L I C   M E T H O D S   - - - - - - - - - - - - - - - - - - - - -">

        /**
         * Returns the PHP extension name.
         *
         * @return string
         * @since  v0.1
         */
        final public function getExtensionName()
        {
            return $this->extensionName;
        }

        # </editor-fold>

    }

}

